﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace testy {
	/// <summary>
	/// klasa testu z pamiętanymi odpowiedziami uzytkownika
	/// </summary>
	public class CheckedTest : Test {
		private new List<CheckedQuestion> questions;
		public CheckedTest(Test t, List<CheckedQuestion> q) {
			this.title = t.Title;
			this.time = t.Time;
			this.questions = q;
		}
		public double Points() { 
			double p = 0;
			for(int i=0; i<this.questions.Count; i++) {
				p+=this.questions[i].Points();
			}
			return p;
		}
		public new List<CheckedQuestion> Questions {
			get { return this.questions; }
		}
		public void getTestWithUnproperAnswers() {
			List<CheckedQuestion> unQs = new List<CheckedQuestion>();
			for(int i=0; i<this.questions.Count; i++) {
				if(!this.questions[i].IsValidAnswer) {
					unQs.Add(this.questions[i]);
				}
			}
			this.questions = unQs;
		}
		public double MaxPoints { 
			get {
				double sum = 0;
				for(int i=0; i<this.questions.Count; i++) {
					sum += this.questions[i].MaxPoints;
				}
				return sum;
			}
		}
	}
}
